package com.lx.patterns.command;

import java.util.ArrayList;
import java.util.List;

public class Waiter {


    private List<Command> commandList = new ArrayList<Command>();


   public void addCommand(Command command){
       commandList.add(command);
   }

   public void orderUp(){
       System.out.println("美女服务员：叮咚，大厨，新订单来了.......");
       for (int i = 0; i < commandList.size(); i++) {
           Command cmd = commandList.get(i);
           if (cmd != null) {
               cmd.execute();
           }
       }
   }
}
